//headers 
#include<algorithm>
#include<cassert>
#include<cstdio>
#include<deque>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<deque>
#include<set>
#include<string>
#include<sstream>
#include<stack>
#include<streambuf>
#include<vector>
#include<stack>
#include<queue>
using namespace std;

//macros
#define LET(x,a) typeof(a) x(a)
#define FOR(i,a,n) for(LET(i,a);i!=n;i++)
#define REP(i,n) FOR(i,0,n)
#define sz size()
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define PRINT(x) REP(_,x.sz) cout<<x[_]<<" "; cout<<endl;
const int INF = (int) 1e8;
#define VI vector<int>
#define VS vector<string>
#define VVI vector< vector<int> >
#define PII pair<int,int>
#define VII vector< PII >
#define LL long long
#define mp make_pair


//code of suren


struct Compare{
  bool operator() (const int &a, const int &b) const{
    return a<b;
  }
};


int main() {
	list<int> l;
	vector<int> revIndex(300000, -2);
	vector<int> index;
	int lastNum = 2;

	revIndex[1] = 0;
	revIndex[2] = 1;
	index.push_back(1);
	index.push_back(2);

	for (int i = 3; i < 500000; ++i)
		l.push_back(i);

	for (int i = 2; i < 100000; ++i) {
		for (list<int>::iterator it = l.begin(); it != l.end(); ++it) {
			if (__gcd(*it, lastNum) != 1) {
				index.push_back(*it);
				revIndex[*it] = i;
				lastNum = *it;
				l.erase(it);
				break;
			}
		}
	}
 PRINT(revIndex);
 return 0;
}
